package cn.smile.controller;

import cn.smile.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: MaoSuyu
 * @User：John
 * @Date: 2019/5/17
 * @Time: 16:54
 * @Description: No Description
 */
@Controller
public class PageController {

    @RequestMapping("/hello")
    public String hello(HttpServletRequest request) {
        Map<String, List<User>> listMap = new HashMap<>();
        List<User> users = new ArrayList<>();
        User liusiqing = new User();
        liusiqing.setAge(17);
        liusiqing.setName("刘思晴");
        liusiqing.setDate(new Date());
        User maosuyu = new User();
        maosuyu.setDate(new Date());
        maosuyu.setName("毛苏雨");
        maosuyu.setAge(18);
        users.add(liusiqing);
        users.add(maosuyu);
        listMap.put("userlist", users);
        request.setAttribute("user", listMap);
        return "/hello";
    }

}
